package cn.tedu.spring.bean;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Repository;


@Repository
public class UserDao {
    /*
        Value注解[依赖注入的注解]：
          1.只能注入基本类型的数据,比如:字符串、整型、浮点型,值都需要添加双引号;
          2.添加位置:
            2.1 添加在属性上;
            2.2 添加在set方法上;
     */
    @Value("jdbc:mysql://localhost:3306/tedu")
    private String url;
    @Value("root")
    private String username;
    @Value("root")
    private String password;

    public UserDao(){}

    public UserDao(String url, String username, String password) {
        this.url = url;
        this.username = username;
        this.password = password;
    }

    public String getUrl() {
        return url;
    }

    public void setUrl(String url) {
        this.url = url;
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }
    public void run(){
        System.out.println("niganma");
    }
    @Override
    public String toString() {
        return "UserDao{" +
                "url='" + url + '\'' +
                ", username='" + username + '\'' +
                ", password='" + password + '\'' +
                '}';
    }
}
